#ifndef LGE_SUBSYSTEM_H
#define LGE_SUBSYSTEM_H

#include <core/lge_uncopyable.h>

/**
  * \brief A generic base class defining what a subsystem is
  */
template<class ConcreteSubsystem>
class Subsystem : public Uncopyable
{
protected:
	static ConcreteSubsystem mInstance;

public:
	/**
	  * \brief Return the instance of the subsystem
	  */
	static ConcreteSubsystem & instance()
	{
		return mInstance;
	}
};

template<class ConcreteSubsystem>
ConcreteSubsystem Subsystem<ConcreteSubsystem>::mInstance;

/**
  * \brief Utility class to initialize a subsystem
  */
template<class Subsystem>
bool initSubsystem(const typename Subsystem::Configuration & config)
{
	return Subsystem::instance().init(config);
}

#endif
